<template>
  <div class="layer" v-if="show" @touchmove.stop="preventD">
    <div class="dialog">
      <div class="dialog-container">
        <h4 class="dialog-title">高级版功能</h4>
        <div class="dialog-content">
          <div class="dialog-content-detail">
            <p class="intro">使用<span>{{coin}}个金币/次</span>，享受以下功能</p>
            <div class="list">
              <div class="list-item" v-for="(item, i) in content" :key="i">
                <i></i>
                <span>{{item}}</span>
              </div>
            </div>
          </div>
          <m-buttton text="使用高级版" type="gold" @onClick="onClick"></m-buttton>
        </div>
      </div>
      <icon type="cancel" size="30" color="#fff" @click="hideDialog"/>
    </div>
  </div>
</template>

<script>
import MButtton from 'comp/m-button'

export default {
  components: {
    MButtton
  },
  props: {
    show: {
      type: Boolean,
      default: false
    },
    coin: {
      type: String,
      default: ''
    }
  },
  data () {
    return {
      content: [
        '可上传3张奖品图片',
        '同时抽取一、二、三等奖',
        '按人数抽奖开奖人数不限',
        '可设置参与条件',
        '自定义推荐语',
        '自定义详细说明，图文编辑'
      ]
    }
  },
  watch: {
    show (val) {
      val ? this.$emit('onShow') : this.$emit('onHide')
    }
  },
  methods: {
    preventD () {},
    hideDialog () {
      this.$emit('update:show', false)
    },
    onClick () {
      this.$emit('onClick')
      this.hideDialog()
    }
  }
}
</script>

<style lang="less" scoped>
.layer {
  z-index: 200;
  position: fixed;
  top: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, .5);
  .dialog {
    width: 100%;
    text-align: center;
    &-container {
      background: #fff;
      margin: 0 50rpx 60rpx;
      border-radius: 8rpx;
    }
    &-title {
      padding: 30rpx 0;
      font-size: 34rpx;
      color: #333;
      border-bottom: 1rpx solid #e6ebf0;
    }
    &-content {
      padding: 40rpx 40rpx;
      text-align: left;
      &-detail {
        font-size: 30rpx;
        color: #333;
        line-height: 52rpx;
        margin-bottom: 40rpx;
        padding: 0 20rpx;
        .intro {
          color: #777;
          font-size: 32rpx;
          span {
            color: #e0382f;
          }
        }
        .list {
          padding: 10rpx 0;
          &-item {
            display: flex;
            align-items: center;
            margin-top: 16rpx;
          }
          i {
            display: block;
            margin-right: 14rpx;
            width: 32rpx;
            height: 32rpx;
            background: url("../../static/images/check.png") no-repeat center center;
            background-size: contain;
          }
        }
      }
    }
  }
}
</style>
